_Pragma("once");


#include <regex>
#include <string>

#include "ExtendDevice.h"
#include "CurrentVoltageInfo.h"


/**
 * 远程抄表模块 电能表
 * @author lizb
 */

class PowerMonitor : public ExtendDevice {
public:


    PowerMonitor(DummyChannel& channel, const ExtendDeviceType& deviceType, const std::string& deviceActknowlege): ExtendDevice(channel, deviceType, deviceActknowlege) {
        maPhase.phase = 'A';
        mbPhase.phase = 'B';
        mcPhase.phase = 'C';

    }

    bool updateInformation();

//    public static final DecimalFormat VOLTAGE_FORMAT = new DecimalFormat("#0");
//    public static final DecimalFormat POWER_FORMAT = new DecimalFormat("#0.00");
//    public static final DecimalFormat CURRENT_FORMAT = new DecimalFormat("000.0");


    /**
     * 电表总功能示数 千瓦时
     */
    std::string mkwh;

    /**
     * 实时功率
     */
    std::string mpower;

    /**
     *  电网频率
     */
    std::string mgridFrequency;

    /**
     *  功率因数
     */
    std::string mcoefficient;

    CurrentVoltageInfo maPhase;
    CurrentVoltageInfo mbPhase;
    CurrentVoltageInfo mcPhase;


protected:
    /**
     *  <W_456621.00_[A/220/000.0][B/220/000.0][C/220/000.0]_OK>
     * @return
     */

    static const std::regex POWER_PATTERN;
};

